﻿<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
    CodeBehind="Photolist.aspx.vb" Inherits="LFC_photosharing._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Welcome to 
        KOP's Photosharing</h2>
    <p>
        &nbsp;<asp:ImageButton ID="ibtm_RSS" runat="server" 
            PostBackUrl="~/RSS.aspx" Height="30px" ImageUrl="~/Imgs/RSS-Icon.png" 
            Width="30px" />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button ID="btn_AddNewPhoto" runat="server" PostBackUrl="~/Addphoto.aspx" 
            Text="Add New Photo" />
    </p>
    <p>View by Tag
        <asp:DataList ID="dl_viewedbytag" runat="server" DataSourceID="SqlDataSource1" 
            RepeatDirection="Horizontal">
            <ItemTemplate>
                <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("TagName","PhotoViewedbyTag.aspx?TagName={0}") %>' style="text-decoration:none "> 
                   &nbsp;&nbsp; &nbsp;&nbsp;
                   <asp:Label ID="TagLabel" runat="server" Text='<%# Eval("TagName") %>' />
                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </asp:HyperLink></ItemTemplate></asp:DataList><asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:KOPConn %>" 
            ProviderName="<%$ ConnectionStrings:KOPConn.ProviderName %>" 
            SelectCommand="SELECT [TagName] FROM [Tag] ORDER BY [TagName]">
        </asp:SqlDataSource>
    </p>
    <p>
        &nbsp;</p><p>
        <asp:GridView ID="GridView1" runat="server" DataSourceID="KOPDataSource" 
            AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID">
            <Columns>
                <asp:BoundField DataField="PhotoName" HeaderText="PhotoName" 
                    SortExpression="PhotoName" />
                <asp:BoundField DataField="UploadDate" HeaderText="UploadDate" 
                    SortExpression="UploadDate" />
                <asp:BoundField DataField="Author" HeaderText="Author" 
                    SortExpression="Author" />
                <asp:BoundField DataField="Category" 
                    HeaderText="Category" SortExpression="Category" /><asp:HyperLinkField DataNavigateUrlFields="Location" 
                    DataNavigateUrlFormatString="https://maps.google.com/maps?q={0}" 
                    DataTextField="Location" HeaderText="Location" />
                <asp:TemplateField HeaderText="Picture(Click to see Details)">
                    <ItemTemplate>
                        <asp:ImageButton ID="ImageButton1" runat="server" 
                            ImageUrl='<%# Eval("Picture", "{0}") %>' 
                            PostBackUrl='<%# Eval("ID", "PhotoDetails.aspx?ID={0}") %>' />
                    </ItemTemplate>
                    <ControlStyle CssClass="image" />
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
          <asp:SqlDataSource ID="KOPDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:KOPConn %>" 
            ProviderName="<%$ ConnectionStrings:KOPConn.ProviderName %>" 
            SelectCommand="SELECT * FROM [Photolist] ORDER BY [ID] DESC"></asp:SqlDataSource>
    </p></asp:Content>
